package com.gyg.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 文档类型枚举
 */
public enum DocumentTypeEnum {

    PDF("pdf", 1, "http://gaoyiguan.cn/cloud/system/pdf.png"),
    DOC("doc", 2, "http://gaoyiguan.cn/cloud/system/doc.png"),
    DOCX("docx", 2, "http://gaoyiguan.cn/cloud/system/doc.png"),
    XLS("xls", 3, "http://gaoyiguan.cn/cloud/system/xlsx.png"),
    XLSX("xlsx", 3, "http://gaoyiguan.cn/cloud/system/xlsx.png"),
    PPT("ppt", 4, "http://gaoyiguan.cn/cloud/system/ppt.png"),
    PPTX("pptx", 4, "http://gaoyiguan.cn/cloud/system/ppt.png");

    /**
     * 文档类型
     */
    private String type;

    /**
     * 所属表中分类
     */
    private Integer belong;

    /**
     * 图片地址
     */
    private String img;

    DocumentTypeEnum (String type, Integer belong, String img) {
        this.type = type;
        this.belong = belong;
        this.img = img;
    }

    public String getType() {
        return type;
    }

    public Integer getBelong() {
        return belong;
    }

    public String getImg() {
        return img;
    }

    public static DocumentTypeEnum getInstance (String type) {
        for (DocumentTypeEnum item : DocumentTypeEnum.values()) {
            if (StringUtils.equals(item.getType(), type)) {
                return item;
            }
        }
        return null;
    }
}
